from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait

if __name__ == '__main__':
    browser = webdriver.Chrome()
    try:
        url = 'https://www.taobao.com/'
        browser.get(url)
        input_first = browser.find_element_by_id('q')
        # 这个配合 Chrome 浏览器的复制 xpath 功能十分好用
        input_second = browser.find_element_by_xpath('//*[@id="q"]')
        print(input_first)
        print(input_second)
    finally:
        browser.close()